//package edu.colorado.karl.trainer;
//
//import java.io.IOException;
//
//import edu.colorado.karl.intelsched.*;
//
//public class Trainer {
//	public static void main(String args[]) {
//
//		//  construct a Randomizer object using a seed
//		Randomizer randomizer = new Randomizer(6);
//
//		// create a net using a configuration file
//		System.out.println("Creating the net");
//		NeuralNet mynet = new NeuralNet("/home/students/boehmap/softcore/tools/Trainer/example1.nnc", randomizer);
//
//		// create a pattern set with 2 input and 1 output values.
//		// randomly choose 80% of data for training, 10% for cross validation, 10% for testing.
//		// the function to be learned is: y = x1 + x2
//		PatternSet mypatterns = new PatternSet("/home/students/boehmap/softcore/tools/Trainer/fulltraindataformat.csv", 10, 2, .8, .1, .1, randomizer);
//
//		// display the error rate before training
//		System.out.println("\n\nError ratio before training: " + mynet.CrossValErrorRatio(mypatterns) );
//
//		// train the net using batch training, until error ratio < 0.02
//		while ( mynet.CrossValErrorRatio(mypatterns) > 0.02 ) {
//			mynet.BatchTrainPatterns(mypatterns.trainingpatterns, .8);
//			System.out.println("Training the net. Error ratio: " + mynet.CrossValErrorRatio(mypatterns) );
//		}
//		
//		// check the error using test data
//		System.out.println("Error ratio of the test data: " + mynet.TestErrorRatio(mypatterns) );
//		
//		System.out.println("Training is over");
//		// note that this was the easiest function to learn. if we had chosen another function
//		// instead of y = x1 + x2, we would need much more training.
//		
//		// now that the training is over, save the weights of the net.
//		System.out.println("Saving the weights\n");
//		try{mynet.SaveWeights("example1.nnw");}catch(IOException e){}
//
//		// clean up the objects
//		mypatterns = null;
//		mynet = null;
//		randomizer = null;
//		
//		///�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/�\_/
//		
//		// now recreate the net using previously saved data and
//		// use the trained net to calculate some numbers.
//		// You could use this part in a separate java class.
//		
//		// recreate the net
//		randomizer = new Randomizer();
//		System.out.println("Recreating the net");
//		mynet = new NeuralNet("example1.nnc", randomizer);
//		mynet.LoadWeights("example1.nnw");
//		
//		// and test it
//		double[] inputs = {69,-9.51,-8.74,-7.44,32.91,31.64,34.4,-6.75,-4.2,-4.38,69,-9.51,-8.74,-7.44,32.91,31.64,34.4,-6.75,-4.2,-4.38};
//		double[] outputs = mynet.Output(inputs); // Although there will be only one output.
//		System.out.println("-0.5 + 0.25 = " + outputs[0] + outputs[1]);
//
//	}
//}
